package com.itheima.HomeWork.Exer;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Predicate;

public class Demo01 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"张无忌","周芷若","赵敏","张强","张三丰");
//        list.stream().filter(s->s.startsWith("张")).filter(s->s.length()==3).forEach(s-> System.out.println(s));
//        list.stream().filter(new Predicate<String>() {
//            @Override
//            public boolean test(String s) {
//                return s.startsWith("张")&&s.length()==3;
//            }
//        }).forEach(s-> System.out.println(s));
        list.stream().filter(new Jdemo01()::test).forEach(s -> System.out.println(s));
    }
}
